/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved. */

#ifndef _E1000_LED_H_
#define _E1000_LED_H_

#include "e1000_hw.h"

enum {
	LED_MODE_LINK_ON = 0,           /* led on when port up; others off */
	LED_MODE_ACT_BLINK = 1,         /* blink when activity; others off */
	LED_MODE_LINK_ON_ACT_BLINK = 2, /* led on when port up; blink when activity */
	LED_MODE_FORCE_ON = 3,
	LED_MODE_FORECE_OFF = 4,
	LED_MODE_FORECE_BLINK = 5,
};

/* LED Control */
#define E1000_LEDCTL_LED0_MODE_SHIFT	0
#define E1000_LEDCTL_LED0_BLINK		0x00000080
#define E1000_LEDCTL_LED0_MODE_MASK	0x0000000F
#define E1000_LEDCTL_LED0_IVRT		0x00000040

#define E1000_LEDCTL_MODE_LED_ON        0xE
#define E1000_LEDCTL_MODE_LED_OFF       0xF

#define E1000_LEDCTL_LED1_MODE_SHIFT    8
#define E1000_LEDCTL_LED2_MODE_SHIFT    16
#define E1000_LEDCTL_LED0_ALL           0x000000FF
#define E1000_LEDCTL_LED0_LINKUP        0x00000002
#define E1000_LEDCTL_LED0_ACT           0x00000003
#define E1000_LEDCTL_LED0_ACT_LINKUP    0x00000004

#define E1000_LED_NUM 3

s32 igb_ctrl_led_generic(struct e1000_hw *hw, s32 led_id, s32 mode);

#endif
